package org.pluslibs.framework.swingplus.utils;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridBagLayout;

import javax.swing.Box;
import javax.swing.JComponent;
import javax.swing.JPanel;

public class JPanelUtils {

	public static Component createEmpty() {
		return Box.createGlue();
	}

    public static Component createEmptyVertical(int height) {
        return Box.createVerticalStrut(height);
    }

	public static Component createVerticalGap(int height) {
		return Box.createVerticalStrut(height);
	}

	public static Component createHorizontalGap(int width) {
		return Box.createHorizontalStrut(width);
	}

	public static JPanel leftAlign(JComponent component) {
		JPanel panel = new JPanel(new BorderLayout());
		panel.add(component, BorderLayout.WEST);
		return panel;
	}

	public static JPanel rightAlign(JComponent component) {
		JPanel panel = new JPanel(new BorderLayout());
		panel.add(component, BorderLayout.EAST);
		return panel;
	}

	public static JPanel centerAlign(JComponent component) {
		JPanel panel = new JPanel(new GridBagLayout());
		panel.add(component);
		return panel;
	}

}
